package com.his.controller;


import com.his.entity.CaseHistory;
import com.his.entity.Patient;
import com.his.entity.Registration;
import com.his.entity.ResponseResult;
import com.his.service.IRegistrationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 就诊(门诊)信息表（一个病人一个病历号，多次就诊，多次就诊信息），也可以看作医院的挂号表\n挂了号相当于开了一 前端控制器
 * </p>
 *
 * @author Demoon Liu
 * @since 2022-02-20
 */

@Tag(name = "RegistrationController--挂号管理接口")
@RestController
@RequestMapping("/registration")
public class RegistrationController {

    @Resource
    public IRegistrationService registrationService;

    @Operation(summary = "3.填病例，并把刚刚写的挂号id传进来",description ="输入：{\n" +
            "  \"chiefcomplaint\": \"string\",\n" +
            "  \"historyofpresentillness\": \"string\",\n" +
            "  \"historyoftreatment\": \"string\",\n" +
            "  \"pasthistory\": \"string\",\n" +
            "  \"allergies\": \"string\",\n" +
            "  \"healthcheckup\": \"string\",\n" +
            "  \"registrationid\": 刚刚挂号registration的id,\n" +
            "  \"name\": \"刚刚挂号patient的姓名\",\n" +
            "  \"gender\": 刚刚挂号patient的姓别（0或者1）,\n" +
            "  \"agestr\": \"刚刚挂号patient的年龄\",\n" +
            "}。 返回：一个casehistory信息")
    @PostMapping("/regishis")  //3.填病例，并把刚刚写的挂号id传进来
    public ResponseResult regisHis( @RequestBody CaseHistory caseHistory){
        return registrationService.regisHis(caseHistory);
    }

    @Operation(summary = "1.先填写病人信息",description ="输入：patient（除id外所有信息）。 返回：一个patient信息  注：patient信息先存起来，待会需要用到！！")
    @PostMapping("/regispeo")  //1.先填写病人信息
    public ResponseResult regisPeo(Patient patient){
        return registrationService.regisPeo(patient);
    };

    @Operation(summary = "2.选择科室挂号",description ="输入：{\n" +
            "  \"patientid\": 刚刚填写的patient的id,\n" +
            "  \"status\": 1,\n" +
            "  \"skdid\": 0,\n" +
            "  \"deptid\": 0,\n" +
            "}。 返回：一个registration信息")
    @PostMapping("/regis")  //2.选择科室挂号
    public ResponseResult regis(Registration registration){
        return registrationService.regis(registration);
    };





}
